package hc.j2me.ui;

import javax.microedition.lcdui.Image;
import javax.microedition.lcdui.game.Sprite;

public class ModeSprite extends Sprite {
	private final Image imageOff, imageOn;
	private boolean isOn = false;
	
	public ModeSprite(Image image, Image imageOn) {
		super(image);
		this.imageOff = image;
		this.imageOn = imageOn;
	}

	public boolean flip(){
		isOn = !isOn;
		if(isOn){
			super.setImage(imageOn, imageOn.getWidth(), imageOn.getHeight());
		}else{
			super.setImage(imageOff, imageOff.getWidth(), imageOff.getHeight());
		}
		return isOn;
	}
}
